import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { UserInfoType } from '@/types/api/user'

export const useUserInfoStore = defineStore(
  'userInfo',
  () => {
    const userInfo = ref<UserInfoType>({
      id: '',
      username: '',
      email: '',
      phoneNumber: ''
    })
    const setUserInfo = (payload: UserInfoType) => {
      userInfo.value = payload
    }
    return { userInfo, setUserInfo }
  },
  { persist: true }
)
